var prefix = jsctx + "/tenantChargeLog";

var chargeLog = $(function () {
    function init() {
        load();
    };

    $('#exampleTable').on('load-success.bs.table', function (e, data) {
        if (data.total && !data.rows.length) {
            $('#exampleTable').bootstrapTable('selectPage').bootstrapTable('refresh');
        }
    });
    var h = $(window).height() - 80;

    function load() {
        $('#exampleTable')
            .bootstrapTable(
                {
                    method: 'get',
                    url: prefix + "/listChargeProcessLog", // 服务器数据的加载地址
                    iconSize: 'outline',
                    toolbar: '#exampleToolbar',
                    striped: true,
                    dataType: "json",
                    pagination: true,
                    singleSelect: false,
                    pageSize: 50,
                    pageList: [50,60,70],
                    pageNumber: 1,
                    sidePagination: "server",
                    paginationShowPageGo: true,
                    height: h,
                    queryParams: function (params) {
                        return {
                            limit: params.limit,
                            offset: (params.offset / params.limit),
                            operatorName: $('#operatorName').val(),
                            orderNum: $("#orderNum").val(),
                            nickName: $("#nickName").val(),
                            startTime: $("#startTime").val(),
                            endTime: $("#endTime").val(),
                            gunNo: $("#gunNo").val()
                        };
                    },
                    columns: [
                        {field: 'orderNum', title: '运营商',width:'100'},
                        // {field: 'platform', title: '平台'},
                        // {field: 'commander', title: '执行人'},
                        {field: 'createTime', title: '通讯时间', width:'100',align: 'left'},
                        {field: 'gunNo', title: '充电枪编号', width:'100',align: 'left'},
                        {field: 'pileSort', title: '充电桩短号', width:'100',align: 'left'},
                        {field: 'elecStation', title: '站点名称', width:'100',align: 'left'},
                        {field: 'operatorName', title: '所属加盟商', width:'100',align: 'left'},
                        {field: 'nickName', title: '用户名', width:'100',align: 'left'},
                        {field: 'carNumber', title: '车牌号', width:'100',align: 'left'},
                        {field: 'temperatureGun', title: '枪温度(°C)', width:'100',align: 'left'},
                        {field: 'power', title: '功率', width:'100',align: 'left'},
                        {field: 'elec', title: '当前电流(A)', width:'100',align: 'left'},
                        {field: 'voltage', title: '当前电压(V)', width:'100',align: 'left'},
                        {field: 'demandElec', title: 'bms最大电流(A)', width:'100',align: 'left'},
                        {field: 'demandVoltage', title: 'bms最大电压(V)', width:'100',align: 'left'},
                        {field: 'temperatureGun', title: 'BMS温度(°C)', width:'100',align: 'left'},
                        {field: 'totalMoney', title: '金额', width:'100',align: 'left'},
                        {field: 'soc', title: 'soc(%)', width:'100',align: 'left'},
                        {
                            title: '操作',
                            field: '_id',
                            width: '200', align: 'center',
                            class: '',
                            formatter: function (value, row, index) {
                                var d = '<a class="btn btn-success btn-sm ' + has_edit + '" href="#" title="详情" onclick="chargeLogDetail.detailTrace(\''
                                    + row._id
                                    + '\')">详情</a> ';
                                return d;


                            }
                        }
                    ]
                });
    }

    function reLoad() {
        $('#exampleTable').bootstrapTable('refresh');
    }
});



